package com.coldchain.auth.feign;

import com.coldchain.auth.configuration.FeignConfiguration;
import com.coldchain.common.auth.AuthUser;
import com.coldchain.common.msg.ObjectRestResponse;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

@FeignClient(value = "${jwt.account-service}",configuration = FeignConfiguration.class)
public interface IUserService {
  /**
   * 通过账户\密码的方式登陆
   * @param scope
   * @param loginName
   * @param password
   * @return
     */
  @PostMapping(value = "/user/validate/pwd")
  public ObjectRestResponse<AuthUser> validatePassword(@RequestParam("scope") String scope, @RequestParam("loginName") String loginName, @RequestParam("password") String password);

    /**
     * 用户当前登录的用户祥情
     * @param
     * @return
     */
    @GetMapping(value = "/user/info")
    public ObjectRestResponse<Map<String,Object>> getCurrentUserInfo();

    /**
     * 用户祥情
     * @param userId
     * @return
     */
  @GetMapping(value = "/user/info/{userId}")
  public ObjectRestResponse<Map<String,Object>> getUserInfoByUserId(@RequestParam("userId") String userId);


  /**
   * 修改用户密码
   * @return
   */
  @PostMapping(value = "/user/modifyPassword")
  public ObjectRestResponse<Map<String,Object>> modifyPassword(@RequestParam("oldpwd") String oldpwd,@RequestParam("newspwd")String newspwd);
}
